Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selectively allow more leading zeros when outputting feature values #1359

Merged

Conversation

cosmin
Copy link
Contributor

@cosmin cosmin commented Apr 22, 2024

During the implementation of FUNQUE+ feature extractors we ran into problems with ST-RRED due to the amount of leading zeros required. Even after applying some normalization factors it would still routinely exceed the 0.6f formatting in VMAF. However changing the default feature format to allow more zeros seemed invasive and broke a bunch of tests.

As a result we selectively enabled printing more digits only when required by the actual feature value, while maintaining compatibility with existing feature extractors which don't need this.

This can wait until the FUNQUE+ feature extractor that requires it.

Co-authored-by: Priyanka-885 [email protected]

…leading zeros which are not handled by 0.6f, instead selectively use more digits in the output, but only if required to maintain compatibility
@nilfm99 nilfm99 requested review from kylophone and nilfm99 April 23, 2024 20:40
@nilfm99
Copy link
Collaborator

nilfm99 commented Apr 23, 2024

Does the dynamic range of the feature span more than 6 orders of magnitude? If so, then I guess this is the way to go, cc @kylophone for another pair of eyes.

In any case, could this be updated to use snake_case in both function name and variable names throughout to match the rest of the code?

@@ -19,6 +19,8 @@
#ifndef __VMAF_OUTPUT_H__
#define __VMAF_OUTPUT_H__

int countLeadingZeroesFloat(float x);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this function could be static and then the header doesn't need to declare it

@@ -44,6 +44,26 @@ static const char *pool_method_name[] = {
[VMAF_POOL_METHOD_HARMONIC_MEAN] = "harmonic_mean",
};

static int count_leading_zeros_flat(double x)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I think this used to be float and got typoed to flat? in either case, it is a bit weird to call it float and have it operate on doubles. There are some uses of the "_s for single, _d for double" convention in this repo, such as here - maybe count_leading_zeros_d?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

welp, that was definitely a typo. Renamed to count_leading_zeros_d as suggested.

if(x < 0)
x = fabs(x);

int intPart = (int)x;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: a couple more snake_case candidates

Copy link
Collaborator

@nilfm99 nilfm99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, let's give it a few days in case @kylophone has any comments and merge

@nilfm99 nilfm99 merged commit b24c3d6 into Netflix:master Apr 30, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants